﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Public;
using BLL;


namespace QLNhanKhau
{
    public partial class UCDoTuoi : UserControl
    {
        public UCDoTuoi()
        {
            InitializeComponent();
        }

        private void reportViewer1_Load(object sender, EventArgs e)
        {
            this.NhankhauTableAdapter.Fill(this.NhanKhauDataSet.Nhankhau);

            this.reportViewer1.RefreshReport();
        }
        private void btnLoc_Click(object sender, EventArgs e)
        {
            this.NhankhauTableAdapter.Fill(this.NhanKhauDataSet.Nhankhau);

            this.reportViewer1.RefreshReport();
        }
        private void UCDoTuoi_Load(object sender, EventArgs e)
        {
            this.NhankhauTableAdapter.Fill(this.NhanKhauDataSet.Nhankhau);

            this.reportViewer1.RefreshReport();
        

        
        
            cmbTrinhDoTu.DataSource = TrinhDoBLL.LoadTrinhDo();
            cmbTrinhDoTu.DisplayMember = "TenTrinhDo";
            cmbTrinhDoTu.ValueMember = "MaTD";
            cmbTrinhDoDen.DataSource = TrinhDoBLL.LoadTrinhDo();
            cmbTrinhDoDen.DisplayMember = "TenTrinhDo";
            cmbTrinhDoDen.ValueMember = "MaTD";
            cmbTonGiao1.DataSource = TonGiaoBLL.LoadTonGiao();
            cmbTonGiao1.DisplayMember = "TenTonGiao";
            cmbTonGiao1.ValueMember = "MaTG";
            cmbTonGiao2.DataSource = TonGiaoBLL.LoadTonGiao();
            cmbTonGiao2.DisplayMember = "TenTonGiao";
            cmbTonGiao2.ValueMember = "MaTG";
            cmbDanToc1.DataSource = DanTocBLL.LoadDanToc();
            cmbDanToc1.DisplayMember = "TenDanToc";
            cmbDanToc1.ValueMember = "MaDT";
            cmbDanToc2.DataSource = DanTocBLL.LoadDanToc();
            cmbDanToc2.DisplayMember = "TenDanToc";
            cmbDanToc2.ValueMember = "MaDT";

        }

        private void cboxTuoi_CheckedChanged(object sender, EventArgs e)
        {
            if (cboxTuoi.Checked == true)
            {
                cmbTuoiTu.Enabled = false;
                cmbTuoiDen.Enabled = false;
                
            }
            else
            {
                cmbTuoiDen.Enabled = true;
                cmbTuoiTu.Enabled = true;
            }
        }

        private void cboxGioiTinh_CheckedChanged(object sender, EventArgs e)
        {
            if (cboxGioiTinh.Checked == true)
            {
                rbtNam.Enabled = false;
                rbtNu.Enabled = false;
            }
            else
            {
                rbtNam.Enabled = true;
                rbtNu.Enabled = true;
            }
        }

        private void cboxTrinhDo_CheckedChanged(object sender, EventArgs e)
        {
            if (cboxTrinhDo.Checked == true)
            {
                cmbTrinhDoTu.Enabled = false;
                cmbTrinhDoDen.Enabled = false;
            }
            else
            {
                cmbTrinhDoDen.Enabled = true;
                cmbTrinhDoTu.Enabled = true;
            }
        }

        private void cboxTonGiao_CheckedChanged(object sender, EventArgs e)
        {
            if (cboxTonGiao.Checked == true)
            {
                cmbTonGiao1.Enabled = false;
                cmbTonGiao2.Enabled = false;
            }
            else
            {
                cmbTonGiao1.Enabled = true;
                cmbTonGiao2.Enabled = true;
            }
        }

        private void cboxDanToc_CheckedChanged(object sender, EventArgs e)
        {
            if (cboxDanToc.Checked == true)
            {
                cmbDanToc1.Enabled = false;
                cmbDanToc2.Enabled = false;
            }
            else
            {
                cmbDanToc1.Enabled = true;
                cmbDanToc2.Enabled = true;
            }
        }
    }
}
